<%@ page import="top.wuyang.study.javawebjdbc.worknews.TbNews" %>
<%@ page import="top.wuyang.study.javawebjdbc.worknews.TbNewsDAO" %><%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2024/5/20
  Time: 18:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加新闻</title>
</head>
<body>


<%
    request.setCharacterEncoding("UTF-8");
    TbNews tbNews = new TbNews();
    tbNews.setTitle( request.getParameter("title") );
    tbNews.setConnent( request.getParameter("connent") );
    int i = TbNewsDAO.insert(tbNews);
    String message = "添加失败";
    if (i==1){
        message = "添加成功";
    }
%>

<script>
    alert("<%=message%>");
    location.href = "newslist.jsp";
</script>

</body>
</html>
